﻿[assembly: log4net.Config.XmlConfigurator(Watch = true)]
namespace WebConversion.Common.Loger
{
    public sealed class LogHelper
    {
        #region constructor
        private static readonly LogHelper Instance = new LogHelper();

        private LogHelper()
        {
            
        }

        public static LogHelper GetInstance()
        {
            return Instance;
        }
        #endregion

        private static readonly log4net.ILog AppLog = log4net.LogManager.GetLogger("AppLog");

        public void Debug(string message)
        {
            DebugFormat(message, null);
        }

        public void DebugFormat(string message, object[] args)
        {
            if (AppLog.IsDebugEnabled)
            { AppLog.DebugFormat(message, args); }
        }

        public void Info(string message)
        {
            InfoFormat(message, null);
        }

        public void InfoFormat(string message, object[] args)
        {
            if (AppLog.IsInfoEnabled)
            { AppLog.InfoFormat(message, args); }
        }

        public void Error(string message)
        {
            ErrorFormat(message, null);
        }

        public void ErrorFormat(string message, object[] args)
        {
            if (AppLog.IsErrorEnabled)
            { AppLog.Error(message); }
        }

        public void Fatal(string message)
        {
            FatalFormat(message, null);
        }

        public void FatalFormat(string message, object[] args)
        {
            if (AppLog.IsFatalEnabled)
            { AppLog.FatalFormat(message, args); }
        }
    }
}
